﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MengLin.OOP.DesignPattern.Responsibility
{
    /// <summary>
    /// 项目经理
    /// </summary>
    public class ProjectManager: AbstractManager
    {
        ///// <summary>
        ///// 下一个审批者
        ///// </summary>
        //private AbstractManager _abstractManager = null;

        ///// <summary>
        ///// 设置下一个审批者
        ///// </summary>
        ///// <param name="abstractManager"></param>
        //public override void SetNext(AbstractManager abstractManager)
        //{
        //    _abstractManager = abstractManager;
        //}

        /// <summary>
        /// 审批
        /// </summary>
        /// <param name="applyContext">请假上下文</param>
        public override void Approval(ApplyContext applyContext)
        {
            if (applyContext.Hour <= 8)
            {
                Console.WriteLine("****项目经理审批通过！****");
                applyContext.ApprovalResult = true;
            }
            else
            {
                //AbstractManager departmentManager = new DepartmentManager();
                //departmentManager.Name = "部门经理李";
                //departmentManager.Approval(applyContext);

                base.ApprovalNext(applyContext);
            }
        }
    }
}
